import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SheetSelectVO, SheetSelectForm, SheetSelectQuery } from '@/api/sheet/sheetSelect/types';

/**
 * 查询应用选择关联列表
 * @param query
 * @returns {*}
 */

export const listSheetSelect = (query?: SheetSelectQuery): AxiosPromise<SheetSelectVO[]> => {
  return request({
    url: '/system/sheetSelect/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询应用选择关联详细
 * @param formId
 */
export const getSheetSelect = (formId: string | number): AxiosPromise<SheetSelectVO> => {
  return request({
    url: '/system/sheetSelect/' + formId,
    method: 'get'
  });
};

/**
 * 新增应用选择关联
 * @param data
 */
export const addSheetSelect = (data: SheetSelectForm) => {
  return request({
    url: '/system/sheetSelect',
    method: 'post',
    data: data
  });
};

/**
 * 修改应用选择关联
 * @param data
 */
export const updateSheetSelect = (data: SheetSelectForm) => {
  return request({
    url: '/system/sheetSelect',
    method: 'put',
    data: data
  });
};

/**
 * 删除应用选择关联
 * @param formId
 */
export const delSheetSelect = (formId: string | number | Array<string | number>) => {
  return request({
    url: '/system/sheetSelect/' + formId,
    method: 'delete'
  });
};
